// Created by Kevin Tan
import 'package:flutter/material.dart';

class AppLocalizations {
  final Locale locale;

  AppLocalizations(this.locale);

  static AppLocalizations? of(BuildContext context) {
    return Localizations.of<AppLocalizations>(context, AppLocalizations);
  }

  static const LocalizationsDelegate<AppLocalizations> delegate = _AppLocalizationsDelegate();

  static const List<Locale> supportedLocales = [
    Locale('en', ''),
    Locale('zh', ''),
  ];

  // App名称
  String get appName => locale.languageCode == 'zh' ? '木鱼大师' : 'Wooden Bell';
  
  // 底部导航栏
  String get navHome => locale.languageCode == 'zh' ? '木鱼' : 'Home';
  String get navStatistics => locale.languageCode == 'zh' ? '统计' : 'Stats';
  String get navSettings => locale.languageCode == 'zh' ? '设置' : 'Settings';

  // 主页
  String get meritLevel => locale.languageCode == 'zh' ? '功德等级' : 'Merit Level';
  String get today => locale.languageCode == 'zh' ? '今日' : 'Today';
  String get session => locale.languageCode == 'zh' ? '本次' : 'Session';
  String get total => locale.languageCode == 'zh' ? '累计' : 'Total';
  String get tapToAccumulate => locale.languageCode == 'zh' ? '点击木鱼，积累功德' : 'Tap the fish to accumulate merit';
  String get autoMode => locale.languageCode == 'zh' ? '自动模式' : 'Auto Mode';
  String get stopAuto => locale.languageCode == 'zh' ? '停止自动' : 'Stop Auto';

  // 等级
  String get levelBeginner => locale.languageCode == 'zh' ? '初学者' : 'Beginner';
  String get levelNovice => locale.languageCode == 'zh' ? '入门者' : 'Novice';
  String get levelPractitioner => locale.languageCode == 'zh' ? '修行者' : 'Practitioner';
  String get levelDiligent => locale.languageCode == 'zh' ? '精进者' : 'Diligent';
  String get levelEnlightened => locale.languageCode == 'zh' ? '觉悟者' : 'Enlightened';
  String get levelMaster => locale.languageCode == 'zh' ? '大师' : 'Master';

  // 祈福语
  List<String> get blessings => locale.languageCode == 'zh' 
    ? [
        '南无阿弥陀佛',
        '功德无量',
        '心想事成',
        '平安喜乐',
        '福慧双修',
        '诸事顺遂',
        '身体健康',
        '家庭和睦',
        '事业有成',
        '学业进步',
        '六时吉祥',
        '善缘具足',
        '智慧增长',
        '烦恼消除',
        '吉祥如意',
      ]
    : [
        'Namo Amitabha',
        'Boundless Merit',
        'Wishes Come True',
        'Peace and Joy',
        'Wisdom and Fortune',
        'All Goes Well',
        'Good Health',
        'Family Harmony',
        'Career Success',
        'Academic Progress',
        'Auspicious Times',
        'Good Karma',
        'Growing Wisdom',
        'Troubles Dissolve',
        'Good Fortune',
      ];

  // 统计页面
  String get statistics => locale.languageCode == 'zh' ? '功德统计' : 'Merit Statistics';
  String get statisticsData => locale.languageCode == 'zh' ? '统计数据' : 'Statistics';
  String get todayMerit => locale.languageCode == 'zh' ? '今日功德' : 'Today\'s Merit';
  String get weekMerit => locale.languageCode == 'zh' ? '本周功德' : 'This Week\'s Merit';
  String get totalMerit => locale.languageCode == 'zh' ? '累计功德' : 'Total Merit';
  String get achievements => locale.languageCode == 'zh' ? '成就徽章' : 'Achievements';

  // 成就
  String achievementTitle(int count) {
    if (locale.languageCode == 'zh') {
      if (count == 100) return '初学者';
      if (count == 500) return '入门者';
      if (count == 1000) return '修行者';
      if (count == 5000) return '精进者';
      if (count == 10000) return '觉悟者';
      if (count == 50000) return '大师';
    } else {
      if (count == 100) return 'Beginner';
      if (count == 500) return 'Novice';
      if (count == 1000) return 'Practitioner';
      if (count == 5000) return 'Diligent';
      if (count == 10000) return 'Enlightened';
      if (count == 50000) return 'Master';
    }
    return '';
  }

  String achievementDescription(int count) {
    return locale.languageCode == 'zh' 
      ? '累计敲击${count}次'
      : 'Tap $count times total';
  }

  String get quote => locale.languageCode == 'zh'
    ? '一切有为法，如梦幻泡影，\n如露亦如电，应作如是观。'
    : 'All conditioned things are like dreams,\nillusions, bubbles, and shadows;\nLike dew and lightning,\nthus should you meditate upon them.';

  // 设置页面
  String get settingsTitle => locale.languageCode == 'zh' ? '设置' : 'Settings';
  String get soundAndVibration => locale.languageCode == 'zh' ? '声音与振动' : 'Sound & Vibration';
  String get enableVibration => locale.languageCode == 'zh' ? '启用振动反馈' : 'Enable Vibration';
  String get vibrationDesc => locale.languageCode == 'zh' ? '敲击时振动' : 'Vibrate on tap';
  String get enableSound => locale.languageCode == 'zh' ? '启用音效' : 'Enable Sound';
  String get soundDesc => locale.languageCode == 'zh' ? '敲击时播放声音' : 'Play sound on tap';
  
  String get appearance => locale.languageCode == 'zh' ? '外观' : 'Appearance';
  String get darkMode => locale.languageCode == 'zh' ? '深色模式' : 'Dark Mode';
  String get darkModeDesc => locale.languageCode == 'zh' ? '使用深色主题' : 'Use dark theme';
  String get themeWillApply => locale.languageCode == 'zh' ? '主题将在重启应用后生效' : 'Theme will apply after restart';
  
  String get dataManagement => locale.languageCode == 'zh' ? '数据管理' : 'Data Management';
  String get resetData => locale.languageCode == 'zh' ? '重置数据' : 'Reset Data';
  String get resetDataDesc => locale.languageCode == 'zh' ? '清除所有功德记录' : 'Clear all merit records';
  String get confirmReset => locale.languageCode == 'zh' ? '确认重置' : 'Confirm Reset';
  String get resetMessage => locale.languageCode == 'zh' ? '确定要重置所有数据吗？此操作不可恢复。' : 'Are you sure you want to reset all data? This action cannot be undone.';
  String get cancel => locale.languageCode == 'zh' ? '取消' : 'Cancel';
  String get confirm => locale.languageCode == 'zh' ? '确定' : 'Confirm';
  String get dataReset => locale.languageCode == 'zh' ? '数据已重置' : 'Data has been reset';
  
  String get about => locale.languageCode == 'zh' ? '关于' : 'About';
  String get appVersion => locale.languageCode == 'zh' ? '应用版本' : 'App Version';
  String get privacyPolicy => locale.languageCode == 'zh' ? '隐私政策' : 'Privacy Policy';
  String get userAgreement => locale.languageCode == 'zh' ? '用户协议' : 'User Agreement';
  String get contactUs => locale.languageCode == 'zh' ? '联系我们' : 'Contact Us';
  String get copyright => locale.languageCode == 'zh' 
    ? '© 2024 Kevin Tan\n木鱼大师 - 心灵的宁静'
    : '© 2024 Kevin Tan\nWooden Bell - Peace of Mind';

  // 条款页面
  String get termsTitle => locale.languageCode == 'zh' ? '服务条款' : 'Terms of Service';
  String get welcomeToApp => locale.languageCode == 'zh' ? '欢迎使用木鱼大师' : 'Welcome to Wooden Bell';
  String get termsIntro => locale.languageCode == 'zh' 
    ? '在使用本应用前，请仔细阅读并同意以下条款：'
    : 'Before using this app, please read and agree to the following terms:';
  String get readPrivacyPolicy => locale.languageCode == 'zh' ? '阅读隐私政策' : 'Read Privacy Policy';
  String get readUserAgreement => locale.languageCode == 'zh' ? '阅读用户协议' : 'Read User Agreement';
  String get agreeAndContinue => locale.languageCode == 'zh' ? '同意并继续' : 'Agree and Continue';
  String get disagreeAndExit => locale.languageCode == 'zh' ? '不同意并退出' : 'Disagree and Exit';
  String get close => locale.languageCode == 'zh' ? '关闭' : 'Close';

  // 隐私政策内容
  String get privacyPolicyContent => locale.languageCode == 'zh' ? '''
隐私政策

最后更新日期：2024年

1. 信息收集
本应用在本地存储以下信息：
- 敲击木鱼的次数统计
- 应用设置偏好（振动、音效等）
- 用户同意条款的记录

我们不会收集、存储或传输任何个人身份信息。

2. 数据使用
所有数据仅存储在您的设备本地，用于：
- 显示功德统计
- 保存应用设置
- 提供个性化体验

3. 数据安全
- 所有数据存储在您的设备本地
- 我们不会访问您的任何数据
- 卸载应用将清除所有本地数据

4. 第三方服务
本应用不使用任何第三方分析或广告服务。

5. 联系我们
如有任何问题，请联系：tan452301@live.com

开发者：Kevin Tan
''' : '''
Privacy Policy

Last Updated: 2024

1. Information Collection
This app stores the following information locally:
- Wooden bell tap statistics
- App settings preferences (vibration, sound, etc.)
- User agreement consent records

We do not collect, store, or transmit any personally identifiable information.

2. Data Usage
All data is stored locally on your device for:
- Displaying merit statistics
- Saving app settings
- Providing personalized experience

3. Data Security
- All data is stored locally on your device
- We do not access any of your data
- Uninstalling the app will clear all local data

4. Third-Party Services
This app does not use any third-party analytics or advertising services.

5. Contact Us
For any questions, please contact: tan452301@live.com

Developer: Kevin Tan
''';

  // 用户协议内容
  String get userAgreementContent => locale.languageCode == 'zh' ? '''
用户协议

最后更新日期：2024年

1. 服务说明
木鱼大师是一款提供虚拟木鱼敲击功能的应用，旨在帮助用户放松心情、修身养性。

2. 使用规则
- 本应用仅供个人使用
- 请合理使用，避免过度依赖
- 本应用不能替代真实的宗教活动

3. 功能说明
- 木鱼敲击及音效播放
- 功德计数和统计
- 成就系统
- 自动模式

4. 免责声明
- 本应用仅作娱乐和放松用途
- 我们不对任何精神或宗教方面的影响负责
- 使用本应用产生的任何后果由用户自行承担

5. 知识产权
本应用的所有内容（包括但不限于文字、图片、音频）归开发者所有。

6. 协议修改
我们保留随时修改本协议的权利。继续使用应用即表示接受修改后的协议。

7. 联系方式
Email: tan452301@live.com

开发者：Kevin Tan
''' : '''
User Agreement

Last Updated: 2024

1. Service Description
Wooden Bell is an app that provides virtual wooden bell tapping functionality, designed to help users relax and cultivate mindfulness.

2. Usage Rules
- This app is for personal use only
- Please use reasonably and avoid over-reliance
- This app cannot replace actual religious activities

3. Features
- Wooden bell tapping with sound effects
- Merit counting and statistics
- Achievement system
- Auto mode

4. Disclaimer
- This app is for entertainment and relaxation purposes only
- We are not responsible for any spiritual or religious effects
- Users bear all consequences resulting from app usage

5. Intellectual Property
All content in this app (including but not limited to text, images, audio) belongs to the developer.

6. Agreement Modifications
We reserve the right to modify this agreement at any time. Continued use of the app indicates acceptance of the modified agreement.

7. Contact Information
Email: tan452301@live.com

Developer: Kevin Tan
''';

  String get privacyPolicyAndAgreement => locale.languageCode == 'zh' 
    ? '隐私政策与用户协议' 
    : 'Privacy Policy & User Agreement';
}

class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
  const _AppLocalizationsDelegate();

  @override
  bool isSupported(Locale locale) {
    return ['en', 'zh'].contains(locale.languageCode);
  }

  @override
  Future<AppLocalizations> load(Locale locale) async {
    return AppLocalizations(locale);
  }

  @override
  bool shouldReload(_AppLocalizationsDelegate old) => false;
}

